home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / X11R4 / cmds / X / ddx / Xsun / sunCG3C.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-07  |  15.5 KB  |  597 lines

  1. /*-
  2.  * sunCG3C.c --
  3.  *    Functions to support the sun CG3 board as a memory frame buffer.
  4.  */
  5.  
  6. /************************************************************
  7. Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA.
  8.  
  9.                     All Rights Reserved
  10.  
  11. Permission  to  use,  copy,  modify,  and  distribute   this
  12. software  and  its documentation for any purpose and without
  13. fee is hereby granted, provided that the above copyright no-
  14. tice  appear  in all copies and that both that copyright no-
  15. tice and this permission notice appear in  supporting  docu-
  16. mentation,  and  that the names of Sun or MIT not be used in
  17. advertising or publicity pertaining to distribution  of  the
  18. software  without specific prior written permission. Sun and
  19. M.I.T. make no representations about the suitability of this
  20. software for any purpose. It is provided "as is" without any
  21. express or implied warranty.
  22.  
  23. SUN DISCLAIMS ALL WARRANTIES WITH REGARD TO  THIS  SOFTWARE,
  24. INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
  25. NESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SUN BE  LI-
  26. ABLE  FOR  ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  27. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,  DATA  OR
  28. PROFITS,  WHETHER  IN  AN  ACTION OF CONTRACT, NEGLIGENCE OR
  29. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION  WITH
  30. THE USE OR PERFORMANCE OF THIS SOFTWARE.
  31.  
  32. ********************************************************/
  33.  
  34. #ifndef    lint
  35. static char sccsid[] = "@(#)sunCG3C.c    1.1 11/3/87 Copyright 1987 Sun Micro";
  36. #endif
  37.  
  38. #include    "sun.h"
  39.  
  40.  
  41. #include    <sys/mman.h>
  42. #ifdef sprite
  43. #undef _MAP_NEW
  44. #endif
  45. #include    <kernel/vmMach.h>
  46. #ifndef    sprite
  47. #include    <pixrect/memreg.h>
  48. /*
  49. #include    <sundev/cg4reg.h>
  50. */
  51. #include    <struct.h>
  52. #endif    sprite
  53.  
  54. #include <sys/types.h>
  55. #include    "colormap.h"
  56. #include    "colormapst.h"
  57. #include    "resource.h"
  58.  
  59. #include "sys/ioctl.h"
  60.  
  61. #include "sys/fb.h"
  62. #undef MAP_NEW
  63.  
  64. struct fbtype fbType;
  65.  
  66. /*-
  67.  * The cg3 frame buffer is divided into several pieces.
  68.  *    1) an array of 8-bit pixels
  69.  *    2) a one-bit deep overlay plane
  70.  *    3) an enable plane
  71.  *    4) a colormap and status register
  72.  *
  73.  * XXX - put the cursor in the overlay plane
  74.  */
  75.  
  76. #define CG3A_HEIGHT      900 
  77. #define CG3A_WIDTH       1152
  78. #define CG3B_HEIGHT     768
  79. #define CG3B_WIDTH     1024
  80.  
  81. typedef struct cg3ac {
  82. #ifdef sparc
  83.     u_char mpixel[128*1024];        /* bit-per-pixel memory */
  84.     u_char epixel[128*1024];        /* enable plane */
  85. #endif
  86.         u_char cpixel[CG3A_HEIGHT][CG3A_WIDTH];   /* byte-per-pixel memory */
  87. } CG3AC, CG3ACRec, *CG3ACPtr;
  88.  
  89. typedef struct cg3bc {
  90. #ifdef sparc
  91.     u_char mpixel[128*1024];        /* bit-per-pixel memory */
  92.     u_char epixel[128*1024];        /* enable plane */
  93. #endif
  94.         u_char cpixel[CG3B_HEIGHT][CG3B_WIDTH];   /* byte-per-pixel memory */
  95. } CG3BC, CG3BCRec, *CG3BCPtr;
  96.  
  97. #define CG3AC_IMAGE(fb)      ((caddr_t)(&(fb)->cpixel))
  98. #define CG3AC_IMAGELEN       (((sizeof (CG3AC) + 4095)/4096)*4096)
  99. #define CG3BC_IMAGE(fb)      ((caddr_t)(&(fb)->cpixel))
  100. #define CG3BC_IMAGELEN       (((sizeof (CG3BC) + 4095)/4096)*4096)
  101.  
  102. static CG3ACPtr CG3ACfb = NULL;
  103. static CG3BCPtr CG3BCfb = NULL;
  104.  
  105.  
  106. static int  sunCG3CScreenIndex;
  107.  
  108. /* XXX - next line means only one CG3 - fix this */
  109. static ColormapPtr sunCG3CInstalledMap;
  110.  
  111. extern int TellLostMap(), TellGainedMap();
  112.  
  113. /*ARGSUSED*/
  114. static void
  115. sunCG3CUpdateColormap(pScreen, index, count, rmap, gmap, bmap)
  116.     ScreenPtr    pScreen;
  117.     int        index, count;
  118.     u_char    *rmap, *gmap, *bmap;
  119. {
  120.     fbcmap sunCmap;
  121.  
  122.     sunCmap.index = index;
  123.     sunCmap.count = count;
  124.     sunCmap.red = &rmap[index];
  125.     sunCmap.green = &gmap[index];
  126.     sunCmap.blue = &bmap[index];
  127.  
  128. #ifdef SUN_WINDOWS
  129.     if (sunUseSunWindows()) {
  130.     static Pixwin *pw = 0;
  131.  
  132.     if (! pw) {
  133.         if ( ! (pw = pw_open(windowFd)) )
  134.         FatalError( "sunCG3CUpdateColormap: pw_open failed\n" );
  135.         pw_setcmsname(pw, "X.V11");
  136.     }
  137.     pw_putcolormap(
  138.         pw, index, count, &rmap[index], &gmap[index], &bmap[index]);
  139.     }
  140. #endif SUN_WINDOWS
  141.  
  142.     if (ioctl(sunFbs[pScreen->myNum].fd, FBIOPUTCMAP, &sunCmap) < 0) {
  143.     perror("sunCG3CUpdateColormap");
  144.     FatalError( "sunCG3CUpdateColormap: FBIOPUTCMAP failed\n" );
  145.     }
  146. }
  147.  
  148. /*-
  149.  *-----------------------------------------------------------------------
  150.  * sunCG3CSaveScreen --
  151.  *    Preserve the color screen by turning on or off the video
  152.  *
  153.  * Results:
  154.  *    None.
  155.  *
  156.  * Side Effects:
  157.  *    Video state is switched
  158.  *
  159.  *-----------------------------------------------------------------------
  160.  */
  161. /*ARGSUSED*/
  162. static Bool
  163. sunCG3CSaveScreen (pScreen, on)
  164.     ScreenPtr      pScreen;
  165.     Bool          on;
  166. {
  167.     int        state = on;
  168.  
  169.     switch (on) {
  170.     case SCREEN_SAVER_FORCER:
  171.     SetTimeSinceLastInputEvent();
  172.     state = 1;
  173.     break;
  174.     case SCREEN_SAVER_OFF:
  175.     state = 1;
  176.     break;
  177.     case SCREEN_SAVER_ON:
  178.     default:
  179.     state = 0;
  180.     break;
  181.     }
  182.     (void) ioctl(sunFbs[pScreen->myNum].fd, FBIOSVIDEO, &state);
  183.  
  184.     return( TRUE );
  185. }
  186.  
  187. /*-
  188.  *-----------------------------------------------------------------------
  189.  * sunCG3CCloseScreen --
  190.  *    called to ensure video is enabled when server exits.
  191.  *
  192.  * Results:
  193.  *    Screen is unsaved.
  194.  *
  195.  * Side Effects:
  196.  *    None
  197.  *
  198.  *-----------------------------------------------------------------------
  199.  */
  200. /*ARGSUSED*/
  201. static Bool
  202. sunCG3CCloseScreen(i, pScreen)
  203.     int        i;
  204.     ScreenPtr    pScreen;
  205. {
  206.     u_char rmap[256], gmap[256], bmap[256];
  207.     Bool ret;
  208.  
  209.     pScreen->CloseScreen = (Bool (*)()) pScreen->devPrivates[sunCG3CScreenIndex].ptr;
  210.     ret = (*pScreen->CloseScreen) (i, pScreen);
  211.  
  212.     /* the following 2 lines are to fix rr clear_colormap bug */
  213.     rmap[255] = gmap[255] = bmap[255] = 0;
  214.     sunCG3CUpdateColormap(pScreen, 255, 1, rmap, gmap, bmap);
  215.  
  216.     sunCG3CInstalledMap = NULL;
  217.     (void)(*pScreen->SaveScreen)(pScreen, SCREEN_SAVER_OFF);
  218.     return ret;
  219. }
  220.  
  221. /*-
  222.  *-----------------------------------------------------------------------
  223.  * sunCG3CInstallColormap --
  224.  *    Install given colormap.
  225.  *
  226.  * Results:
  227.  *    None
  228.  *
  229.  * Side Effects:
  230.  *    Existing map is uninstalled.
  231.  *    All clients requesting ColormapNotify are notified
  232.  *
  233.  *-----------------------------------------------------------------------
  234.  */
  235. /*ARGSUSED*/
  236. static void
  237. sunCG3CInstallColormap(cmap)
  238.     ColormapPtr    cmap;
  239. {
  240.     register int i;
  241.     register Entry *pent;
  242.     register VisualPtr pVisual = cmap->pVisual;
  243.     u_char      rmap[256], gmap[256], bmap[256];
  244.  
  245.     if (cmap == sunCG3CInstalledMap)
  246.     return;
  247.     if (sunCG3CInstalledMap)
  248.     WalkTree(sunCG3CInstalledMap->pScreen, TellLostMap,
  249.          (char *) &(sunCG3CInstalledMap->mid));
  250.     if ((pVisual->class | DynamicClass) == DirectColor) {
  251.     for (i = 0; i < 256; i++) {
  252.         pent = &cmap->red[(i & pVisual->redMask) >>
  253.                   pVisual->offsetRed];
  254.         rmap[i] = pent->co.local.red >> 8;
  255.         pent = &cmap->green[(i & pVisual->greenMask) >>
  256.                 pVisual->offsetGreen];
  257.         gmap[i] = pent->co.local.green >> 8;
  258.         pent = &cmap->blue[(i & pVisual->blueMask) >>
  259.                    pVisual->offsetBlue];
  260.         bmap[i] = pent->co.local.blue >> 8;
  261.     }
  262.     } else {
  263.     for (i = 0, pent = cmap->red;
  264.          i < pVisual->ColormapEntries;
  265.          i++, pent++) {
  266.         if (pent->fShared) {
  267.         rmap[i] = pent->co.shco.red->color >> 8;
  268.         gmap[i] = pent->co.shco.green->color >> 8;
  269.         bmap[i] = pent->co.shco.blue->color >> 8;
  270.         }
  271.         else {
  272.         rmap[i] = pent->co.local.red >> 8;
  273.         gmap[i] = pent->co.local.green >> 8;
  274.         bmap[i] = pent->co.local.blue >> 8;
  275.         }
  276.     }
  277.     }
  278.     sunCG3CInstalledMap = cmap;
  279.     sunCG3CUpdateColormap(cmap->pScreen, 0, 256, rmap, gmap, bmap);
  280.     WalkTree(cmap->pScreen, TellGainedMap, (char *) &(cmap->mid));
  281. }
  282.  
  283. /*-
  284.  *-----------------------------------------------------------------------
  285.  * sunCG3CUninstallColormap --
  286.  *    Uninstall given colormap.
  287.  *
  288.  * Results:
  289.  *    None
  290.  *
  291.  * Side Effects:
  292.  *    default map is installed
  293.  *    All clients requesting ColormapNotify are notified
  294.  *
  295.  *-----------------------------------------------------------------------
  296.  */
  297. /*ARGSUSED*/
  298. static void
  299. sunCG3CUninstallColormap(cmap)
  300.     ColormapPtr    cmap;
  301. {
  302.     if (cmap == sunCG3CInstalledMap) {
  303.     Colormap defMapID = cmap->pScreen->defColormap;
  304.  
  305.     if (cmap->mid != defMapID) {
  306.         ColormapPtr defMap = (ColormapPtr) LookupIDByType(defMapID,
  307.                                   RT_COLORMAP);
  308.  
  309.         if (defMap)
  310.         (*cmap->pScreen->InstallColormap)(defMap);
  311.         else
  312.             ErrorF("sunCG3C: Can't find default colormap\n");
  313.     }
  314.     }
  315. }
  316.  
  317. /*-
  318.  *-----------------------------------------------------------------------
  319.  * sunCG3CListInstalledColormaps --
  320.  *    Fills in the list with the IDs of the installed maps
  321.  *
  322.  * Results:
  323.  *    Returns the number of IDs in the list
  324.  *
  325.  * Side Effects:
  326.  *    None
  327.  *
  328.  *-----------------------------------------------------------------------
  329.  */
  330. /*ARGSUSED*/
  331. static int
  332. sunCG3CListInstalledColormaps(pScreen, pCmapList)
  333.     ScreenPtr    pScreen;
  334.     Colormap    *pCmapList;
  335. {
  336.     *pCmapList = sunCG3CInstalledMap->mid;
  337.     return (1);
  338. }
  339.  
  340.  
  341. /*-
  342.  *-----------------------------------------------------------------------
  343.  * sunCG3CStoreColors --
  344.  *    Sets the pixels in pdefs into the specified map.
  345.  *
  346.  * Results:
  347.  *    None
  348.  *
  349.  * Side Effects:
  350.  *    None
  351.  *
  352.  *-----------------------------------------------------------------------
  353.  */
  354. /*ARGSUSED*/
  355. static void
  356. sunCG3CStoreColors(pmap, ndef, pdefs)
  357.     ColormapPtr    pmap;
  358.     int        ndef;
  359.     xColorItem    *pdefs;
  360. {
  361.     u_char    rmap[256], gmap[256], bmap[256];
  362.     register int i;
  363.     register Entry *pent;
  364.  
  365.     if (pmap != sunCG3CInstalledMap)
  366.     return;
  367.     while (ndef--) {
  368.     i = pdefs->pixel;
  369.     rmap[i] = pdefs->red >> 8;
  370.     gmap[i] = pdefs->green >> 8;
  371.     bmap[i] = pdefs->blue >> 8;
  372.     sunCG3CUpdateColormap(pmap->pScreen, i, 1, rmap, gmap, bmap);
  373.     pdefs++;
  374.     }
  375. }
  376.  
  377. /*-
  378.  *-----------------------------------------------------------------------
  379.  * sunCG3CInit --
  380.  *    Attempt to find and initialize a cg3 framebuffer
  381.  *
  382.  * Results:
  383.  *    TRUE if everything went ok. FALSE if not.
  384.  *
  385.  * Side Effects:
  386.  *    Most of the elements of the ScreenRec are filled in. Memory is
  387.  *    allocated for the frame buffer and the buffer is mapped. The
  388.  *    video is enabled for the frame buffer...
  389.  *
  390.  *-----------------------------------------------------------------------
  391.  */
  392. /*ARGSUSED*/
  393. static Bool
  394. sunCG3CInit (index, pScreen, argc, argv)
  395.     int              index;        /* The index of pScreen in the ScreenInfo */
  396.     ScreenPtr      pScreen;      /* The Screen to initialize */
  397.     int              argc;            /* The number of the Server's arguments. */
  398.     char          **argv;       /* The arguments themselves. Don't change! */
  399. {
  400.     if (!cfbScreenInit (pScreen,
  401. #ifndef sprite
  402.             (sunFbs[index].info.fb_width == CG3A_WIDTH) ?
  403.             (int *) CG3ACfb->cpixel : (int *) CG3BCfb->cpixel,
  404. #else
  405.             sunFbs[index].fb,
  406. #endif
  407.             sunFbs[index].info.fb_width,
  408.             sunFbs[index].info.fb_height,
  409.             monitorResolution, monitorResolution,
  410.             sunFbs[index].info.fb_width))
  411.     return (FALSE);
  412.  
  413.     pScreen->SaveScreen = sunCG3CSaveScreen;
  414.     pScreen->devPrivates[sunCG3CScreenIndex].ptr = (pointer) pScreen->CloseScreen;
  415.     pScreen->CloseScreen = sunCG3CCloseScreen;
  416.  
  417. #ifndef STATIC_COLOR
  418.     pScreen->InstallColormap = sunCG3CInstallColormap;
  419.     pScreen->UninstallColormap = sunCG3CUninstallColormap;
  420.     pScreen->ListInstalledColormaps = sunCG3CListInstalledColormaps;
  421.     pScreen->StoreColors = sunCG3CStoreColors;
  422. #endif
  423.  
  424.     sunCG3CSaveScreen( pScreen, SCREEN_SAVER_FORCER );
  425.     return (sunScreenInit(pScreen) && cfbCreateDefColormap(pScreen));
  426. }
  427.  
  428. /*-
  429.  *-----------------------------------------------------------------------
  430.  * sunCG3CProbe --
  431.  *    Attempt to find and initialize a cg3 framebuffer
  432.  *
  433.  * Results:
  434.  *    TRUE if everything went ok. FALSE if not.
  435.  *
  436.  * Side Effects:
  437.  *    Memory is allocated for the frame buffer and the buffer is mapped.
  438.  *
  439.  *-----------------------------------------------------------------------
  440.  */
  441. /*ARGSUSED*/
  442. Bool
  443. sunCG3CProbe (pScreenInfo, index, fbNum, argc, argv)
  444.     ScreenInfo      *pScreenInfo;    /* The screenInfo struct */
  445.     int              index;        /* The index of pScreen in the ScreenInfo */
  446.     int              fbNum;        /* Index into the sunFbData array */
  447.     int              argc;            /* The number of the Server's arguments. */
  448.     char          **argv;       /* The arguments themselves. Don't change! */
  449. {
  450.     int         fd;
  451.     struct fbtype fbType;
  452.  
  453.  
  454.     printf("sunCG3CProbe: fbNum = %d , index = %d, argc= %d\n",
  455.     fbNum, index, argc);
  456.  
  457.     if ((fd = sunOpenFrameBuffer(FBTYPE_SUN3COLOR, &fbType, index, fbNum,
  458.                  argc, argv)) < 0)
  459.     return FALSE;
  460.  
  461. #ifdef    _MAP_NEW
  462.     if (fbType.fb_width == CG3A_WIDTH) {
  463.     if ((int)(CG3ACfb = (CG3ACPtr) mmap((caddr_t) 0,
  464.          CG3AC_IMAGELEN,
  465.          PROT_READ | PROT_WRITE,
  466.          MAP_SHARED | _MAP_NEW, fd, 0)) == -1) {
  467.         Error("Mapping cg3c");
  468.         (void) close(fd);
  469.         return FALSE;
  470.     }
  471.     }
  472.     else if (fbType.fb_width == CG3B_WIDTH) {
  473.     if ((int)(CG3BCfb = (CG3BCPtr) mmap((caddr_t) 0,
  474.          CG3BC_IMAGELEN,
  475.          PROT_READ | PROT_WRITE,
  476.          MAP_SHARED | _MAP_NEW, fd, 0)) == -1) {
  477.         Error("Mapping cg3c");
  478.         (void) close(fd);
  479.         return FALSE;
  480.     }
  481.     }
  482.     else {
  483.         Error("Mapping cg3c");
  484.         (void) close(fd);
  485.         return FALSE;
  486.     }
  487. #else    _MAP_NEW
  488.     if (fbType.fb_width == CG3A_WIDTH) {
  489. #ifdef sprite
  490.     int    sizeToUse;
  491.  
  492.     sizeToUse = ((fbType.fb_size + VMMACH_SEG_SIZE) & ~(VMMACH_SEG_SIZE-1))
  493.         + VMMACH_SEG_SIZE;
  494.     CG3ACfb = (CG3ACPtr) malloc(sizeToUse);
  495.     printf("original CG3ACfb addr: 0x%x, original size: 0x%x\n",
  496.         CG3ACfb, sizeToUse);
  497. #else
  498.     CG3ACfb = (CG3ACPtr) valloc(CG3AC_MONOLEN + 
  499.         CG3AC_ENBLEN + CG3AC_IMAGELEN);
  500. #endif /* sprite */
  501.     if (CG3ACfb == (CG3ACPtr) NULL) {
  502.         ErrorF("Could not allocate room for frame buffer.\n");
  503.         return FALSE;
  504.     }
  505.  
  506. #ifdef sprite
  507.     CG3ACfb = (CG3ACPtr) mmap((caddr_t) CG3ACfb, fbType.fb_size,
  508.         PROT_READ | PROT_WRITE,
  509.         MAP_SHARED, fd, 0);
  510.     if (CG3ACfb == (CG3ACPtr) NULL) {
  511. #else
  512.     if (mmap((caddr_t) CG3ACfb, CG3AC_MONOLEN + 
  513.         CG3AC_ENBLEN + CG3AC_IMAGELEN,
  514.         PROT_READ | PROT_WRITE,
  515.         MAP_SHARED, fd, 0) < 0) {
  516. #endif /* sprite */
  517.         Error("Mapping cg3c");
  518.         (void) close(fd);
  519.         return FALSE;
  520.     } else {
  521.         printf("new addr for CG3ACfb: 0x%x\n", CG3ACfb);
  522.     }
  523.     }
  524.     else if (fbType.fb_width == CG3B_WIDTH) {
  525. #ifdef sprite
  526.     int    sizeToUse;
  527.  
  528.     sizeToUse = ((fbType.fb_size + VMMACH_SEG_SIZE) & ~(VMMACH_SEG_SIZE-1))
  529.         + VMMACH_SEG_SIZE;
  530.     CG3BCfb = (CG3BCPtr) malloc(sizeToUse);
  531.     printf("original CG3BCfb addr: 0x%x, original size: 0x%x\n",
  532.         CG3BCfb, sizeToUse);
  533. #else
  534.     CG3BCfb = (CG3BCPtr) valloc(CG3BC_MONOLEN + 
  535.         CG3BC_ENBLEN + CG3BC_IMAGELEN);
  536. #endif /* sprite */
  537.     if (CG3BCfb == (CG3BCPtr) NULL) {
  538.         ErrorF("Could not allocate room for frame buffer.\n");
  539.         return FALSE;
  540.     }
  541. #ifdef sprite
  542.     CG3BCfb = (CG3BCPtr) mmap((caddr_t) CG3BCfb, fbType.fb_size,
  543.         PROT_READ | PROT_WRITE,
  544.         MAP_SHARED, fd, 0);
  545.     if (CG3BCfb == (CG3BCPtr) NULL) {
  546. #else
  547.     if (mmap((caddr_t) CG3BCfb, CG3BC_MONOLEN + 
  548.         CG3BC_ENBLEN + CG3BC_IMAGELEN,
  549.         PROT_READ | PROT_WRITE,
  550.         MAP_SHARED, fd, 0) < 0) {
  551. #endif /* sprite */
  552.         Error("Mapping cg3c");
  553.         (void) close(fd);
  554.         return FALSE;
  555.     } else {
  556.         printf("new addr for CG3BCfb: 0x%x\n", CG3BCfb);
  557.     }
  558.     }
  559.     else {
  560.         Error("Mapping cg3c");
  561.         (void) close(fd);
  562.         return FALSE;
  563.     }
  564. #endif    _MAP_NEW
  565.  
  566.     sunFbs[index].info = fbType;
  567. /*  sunFbs[index].EnterLeave = sunCG3CSwitch;    */
  568. #ifndef sprite
  569.     sunFbs[index].fb = (pointer) fb_Addr.fb_buffer;
  570. #else
  571.     if (fbType.fb_width == CG3A_WIDTH) {
  572.     sunFbs[index].fb = (pointer) CG3ACfb;
  573.     } else if (fbType.fb_width == CG3B_WIDTH) {
  574.     sunFbs[index].fb = (pointer) CG3BCfb;
  575.     }
  576. #endif /*sprite*/
  577.     sunFbs[index].fd = fd;
  578.     sunSupportsDepth8 = TRUE;
  579.     return TRUE;
  580. }
  581.  
  582. /*ARGSUSED*/
  583. Bool
  584. sunCG3CCreate(pScreenInfo, argc, argv)
  585.     ScreenInfo      *pScreenInfo;
  586.     int              argc;
  587.     char          **argv;
  588. {
  589.     if (sunGeneration != serverGeneration)
  590.     {
  591.     sunCG3CScreenIndex = AllocateScreenPrivateIndex();
  592.     if (sunCG3CScreenIndex < 0)
  593.         return FALSE;
  594.     }
  595.     return (AddScreen(sunCG3CInit, argc, argv) >= 0);
  596. }
  597.